<extend name="Base/common" />
<block name="body">
<div class="span9 page_message">
	<section id="contents">
      <include file="Addons/_nav" />
      
      <div class="tab-content" id="hasSubNav"> 
        	<div class="sub_tab_content">
            <form>
            	<ul class="template_select">
                    <volist name="tempList" id="vo">
                    <li class="template_item {$vo.class}">
                    	<if condition = "!empty($vo[desc])">
                    	<div class="use_tips">{$vo.desc}</div>
                        </if>
                    	<div class="phone">
                        	<img src="{$vo.icon}" />
                        </div>
                        <p><input type="radio" {$vo.checked} name="template" id="template_{$vo.dirName}" value="{$vo.dirName}"/>
                        <label for="template_{$vo.dirName}">{$vo.title}</label></p>
                    </li>
                    </volist>
                </ul>
              </form>
            </div>
      </div>
    </section>
 </div>
</block>

<block name="script">
<script type="text/javascript" charset="utf-8">
	//导航高亮
    $('.side-sub-menu').find('a[href="{:U('Addons/index')}"]').closest('li').addClass('current');
    if($('ul.tab-nav').length){
    	$('.btn-return').hide();
    }
	$(function(){
		showTab();
		//选择模板并且ajax提交
		//选择Ajax提交		
		$('.template_item').click(function(){
			if(!$(this).hasClass('selected')){
				$(this).addClass('selected');
				$(this).siblings().removeClass("selected");
				$(this).find('input').click();

				//如果不是ajax提交 不要以下代码"{:$_GET['_action']}"
				var value = $(this).find('input').val();
				var type = "{:$_GET['_action']}";
				$.ajax({
					url:"{:U('save')}",
					data:{template:value,type:type},
					type:"post",
					dataType:"json",
					success:function(data){
						if(data.status){
							//提交成功
							}
						}
					})
				}
			});
	})
	$('.template_item').hover(function(){
			$(this).find('.use_tips').stop().fadeIn();
			$(this).addClass('hover');
		},function(){
			$(this).find('.use_tips').stop().fadeOut();
			$(this).removeClass('hover');
			})
</script>
</block>
